package com.wyvoid.forum.web.action.admin.usergroup;

import com.wyvoid.forum.web.action.admin.BaseAdminAction;
import com.wyvoid.forum.service.IUserGroupService;
import com.wyvoid.forum.domain.UserGroup;
import net.sourceforge.stripes.integration.spring.SpringBean;
import net.sourceforge.stripes.action.Resolution;
import net.sourceforge.stripes.action.DefaultHandler;
import net.sourceforge.stripes.action.UrlBinding;

import java.util.List;

/**
 * User: cjp
 * Date: 2007-7-1
 * Time: 21:10:10
 */
@UrlBinding(value = "/admin/userGroupManage.do")
public class UserGroupManageAction extends BaseAdminAction {
    @SpringBean
    private IUserGroupService userGroupService;
    private List<UserGroup> memberUserGroups;
    private List<UserGroup> otherUserGroups;
    private List<UserGroup> systemUserGroups;

    public List<UserGroup> getMemberUserGroups() {
        return memberUserGroups;
    }

    public List<UserGroup> getOtherUserGroups() {
        return otherUserGroups;
    }

    public List<UserGroup> getSystemUserGroups() {
        return systemUserGroups;
    }

    public void setUserGroupService(IUserGroupService userGroupService) {
        this.userGroupService = userGroupService;
    }

    @DefaultHandler
    public Resolution viewAllGroups(){
        memberUserGroups=userGroupService.getMemberUserGroups();
        otherUserGroups=userGroupService.getOtherUserGroups();
        systemUserGroups=userGroupService.getSystemUserGroups();
        return getAdminResolution("usergroup/viewUserGroups");
    }

    
}
